home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 255_01 / gpwtcol.asm < prev    next >
Encoding:
Assembly Source File  |  1988-03-28  |  2.8 KB  |  85 lines

  1.           page   80,132
  2.           page
  3. ;
  4. ;         Kent Cedola
  5. ;         2015 Meadow Lake Court
  6. ;         Norfolk, Virginia  23518
  7. ;
  8.  
  9. dgroup    group  _data
  10.  
  11. _data     segment word public 'data'
  12.           assume ds:dgroup
  13.  
  14.           extrn  _gdmerge:byte
  15.           extrn  _gdcur_x:word,_gdcur_y:word
  16.           extrn  _gdvw_x1:word,_gdvw_x2:word,_gdvw_x3:word
  17.           extrn  _gdvw_y1:word,_gdvw_y2:word,_gdvw_y3:word
  18.           extrn  _gdc_flg:byte
  19.  
  20. _data     ends
  21.  
  22. _text     segment byte public 'code'
  23.  
  24.           assume cs:_text,ds:dgroup
  25.           public _gpwtcol
  26. _gpwtcol  proc   near
  27.  
  28.           push   bp
  29.           mov    bp,sp
  30.           push   si
  31.           push   di
  32.  
  33.           mov    ax,_GDCUR_Y           ; Compute the segment of the graphic
  34.           shl    ax,1                  ;   byte that is to be changed
  35.           shl    ax,1                  ;   ES = A000 + (80 * Y) / 16;
  36.           add    ax,_GDCUR_Y           ;   ...
  37.           add    ax,0A000h             ;   ...
  38.           mov    es,ax                 ;   ...
  39.           mov    di,_GDCUR_X           ; Compute the column byte offset
  40.           mov    cx,di                 ;   ... (Save for later)
  41.           shr    di,1                  ;   DI = X / 8;
  42.           shr    di,1                  ;   ...
  43.           shr    di,1                  ;   ...
  44.           mov    dx,03CEh              ; Load graphic controller's address port
  45.           mov    ah,_GDMERGE
  46.           mov    al,3
  47.           out    dx,ax
  48.           mov    ax,0205h              ; Mask value is in address three (3)
  49.           out    dx,ax                 ; Point to the mask register
  50.           mov    al,8                  ; Mask value is in address eight (8)
  51.           out    dx,al                 ; Point to the mask register
  52.           inc    dx                    ; Bump port addr to the mask register
  53.           mov    al,80h                ; Compute mask byte to change one bit
  54.           and    cl,7                  ;   ...  (It has to be done this way to
  55.           ror    al,cl                 ;   ...   use merge value in write)
  56.           out    dx,al
  57.  
  58.           mov    cx,[bp+6]
  59.           mov    si,[bp+4]
  60. nextbit:
  61.           mov    ah,[si]
  62.           inc    si
  63.           mov    bl,es:[di]
  64.           mov    es:[di],ah            ; Apply merge function to bit and store
  65.           add    di,80
  66.           loop   nextbit
  67.  
  68.           mov    al,0FFh
  69.           out    dx,al                 ; Restore the mask byte (for text)
  70.           dec    dx
  71.           mov    ax,0005h
  72.           out    dx,ax
  73.           mov    ax,0003h
  74.           out    dx,ax
  75.  
  76.           pop    di
  77.           pop    si
  78.           pop    bp
  79.           ret
  80.  
  81. _gpwtcol  endp
  82.  
  83. _text     ends
  84.           end
  85.